<template>
	<!-- 获取一个数组，结构为[{time:'时间',info:'内容内容'}] -->
	<!-- @click事件返回点击标签元素的索引值 第一项为0 -->
	<view class="bg">
		<view class="steps">
			<view class="steps_item" v-for="(i, index) in infoList">
				<view class="s_time">
					<text>{{ i.unlockTime.slice(0, 10) }}</text>
					<text>{{ i.unlockTime.slice(11, 16) }}</text>
				</view>
				<view class="s_r">
					<view class="line" :style="{backgroundColor:index != 0?backgroundColor:'rgba(0,0,0,0)'}"></view>
					<view class="index" :style="{backgroundColor: i.replyCode == '00' ? '#D8D8D8' : '#FF3434',color:color}">
					</view>
					<view class="line" :style="{backgroundColor:index != infoList.length-1?backgroundColor:'rgba(0,0,0,0)'}"></view>
				</view>
				<view class="s_l">
					<!-- @tap="topage(index)" -->
					<view class="info_item">
						<!-- 刷卡  内开 密码这些都是没有用户的 -->
						<view :style="{WebkitLineClamp:lineNum!=0?lineNum:''}">{{ i.name && (i.taskType !== 'PASSWORDUNLOCK' &&  i.taskType !== 'INDOORUNLOCK' && i.taskType !== 'SWIPCARDUNLOCK')? i.name: ''}} {{getway(i.taskType)}} {{ i.replyCode == '00' ? '成功' : '失败' }}</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: 'YSteps',
		props: {
			infoList: {
				type: Array,
				default: []
			},
			color: {
				type: String,
				default: '#fff'
			},
			backgroundColor: {
				type: String,
				default: '#ff3838'
			},
			lineNum: {
				type: Number,
				default: 0
			}
		},
		data() {
			return {};
		},
		onLoad(e) {
			//获取列表
		},
		methods: {
			// topage(e) {
			// 	this.$emit('click', e);
			// },
			getway(type){
				switch(type){
					case 'UNLOCK': return '蓝牙开锁'
					break;
					case 'LOCK': return '蓝牙关锁'
					break;
					case 'REMOTEUNLOCK': return '远程开锁'
					break;
					case 'PASSWORDUNLOCK': return '密码开锁'
					break;
					case 'INDOORUNLOCK': return '门内开锁'
					break;
					case 'SWIPCARDUNLOCK': return '刷卡开锁'
					break;
					default: return '未知开锁方式'
					break;
				}
			}
		}
	};
</script>

<style lang="scss" scoped>
	page {
		background-color: #f2f2f2;
	}

	.bg {
		// margin: 20upx 0;
		background-color: #FFFFFF;
		display: flex;
		padding: 10rpx;
	}

	.steps {
		display: flex;
		flex-direction: column;
		.steps_item {
			display: flex;
			.s_time {
				width: 210rpx;
				padding: 50rpx 20rpx;
				display: flex;
				flex-direction: column;
				align-items: center;
			}
			.s_r {
				margin: 0 20rpx;
				display: flex;
				flex-direction: column;
				align-items: center;

				.line {
					flex: 1;
					width: 4rpx;
					background-color: #fff;
				}

				.index {
					width: 12rpx;
					height: 12rpx;
					font-size: 12px;
					text-align: center;
					line-height: 40rpx;
					border-radius: 50rpx;
				}
			}

			.s_l {
				max-width: 400rpx;
				display: flex;
				flex-direction: column;
				padding: 20rpx 0;

				.info_item {
					background-color: #FFFFFF;
					margin-right: 30upx;
					border-radius: 10upx;
					display: flex;
					flex-direction: column;
					justify-content: center;
					padding: 30upx;
					box-shadow: 0 10rpx 30rpx #ddd;

					text {
						font-size: 18px;
						font-weight: 500;
						color: rgba(51, 51, 51, 1);
						line-height: 25px;
					}

					view {
						font-size: 14px;
						font-weight: 400;
						color: rgba(102, 102, 102, 1);
						line-height: 20px;
						overflow: hidden;
						text-overflow: ellipsis;
						display: -webkit-box;

						flex-direction: column;
					}
				}

				.info_item:active {
					background-color: #f4f4f4;
				}
			}
		}
	}
</style>
